//
//  FacViewController.m
//  PlayDAs
//
//  Created by 周莹 on 15/12/19.
//  Copyright © 2015年 周莹. All rights reserved.
//

#import "FacViewController.h"
#import "FacView.h"
// 左右两边的间距
#define MARGIN_1 10.0f
// 按钮的Y值
#define IMAGE_Y  18.0f
// 按钮的Y值
#define BUTTON_Y  18.0f
// 男女之间的间距
#define MARGIN_2 5.0f

// 第一个按钮的宽
#define BUTTON_1_W 95.0f

// 按钮的高
#define BUTTON_H 30.0f
@interface FacViewController ()

@end

@implementation FacViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creat];
//    FacView * views = [[FacView alloc] initWithFrame:self.view.bounds];
//   // views.backgroundColor = [UIColor orangeColor];
//    [self.view addSubview:views];
//    [views logoimageName:@"mei.jpg" image:nil image:nil imagename3:nil];
//
    
}


-(void)creat{
    self.scrollView = [[UIScrollView alloc]init];
    
    self.scrollView.contentSize = CGSizeMake(SCREEN_WIDTH,SCREEN_HEIGHT );
    
    
    self.scrollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 64);
    [ self.view   addSubview:self.scrollView];
    
    
    //logoImage
    CGFloat logoImageW = SCALE_WIDTH(BUTTON_1_W);
    CGFloat logoImageH = SCALE_WIDTH(BUTTON_H+30);
    CGFloat logoImageX = MARGIN_2;
    CGFloat logoImageY = BUTTON_Y;
    
    self.Logoimage = [[UIImageView  alloc] initWithImage:[UIImage imageNamed:@"mei.jpg"]];
    self.Logoimage.frame = CGRectMake(logoImageX, logoImageY, logoImageW, logoImageH);
    [self.scrollView  addSubview:self.Logoimage];
    
    
    
    //facName
    
    CGFloat w = (SCREEN_WIDTH  -(MARGIN_2 *2) - (MARGIN_1 * 3) - logoImageX)/2;
    
    CGFloat btn1W = w- 80;
    CGFloat btn1H = SCALE_WIDTH(BUTTON_H - 10);
    CGFloat btn1X = CGRectGetMaxX(self.Logoimage.frame)+MARGIN_1;
    CGFloat btn1Y = BUTTON_Y;
    
    
    self.facName = [[UILabel alloc] initWithFrame:CGRectMake(btn1X, btn1Y, btn1W, btn1H)];
    self.facName.text = @"单位名称";
    self.facName.backgroundColor = [UIColor  yellowColor];
    [self.scrollView  addSubview:self.facName];
    
    //bunisee
    
    CGFloat buniseeW = w- 80;
    CGFloat buniseeH = SCALE_WIDTH(BUTTON_H - 10);
    CGFloat buniseeX = CGRectGetMaxX(self.Logoimage.frame)+MARGIN_1;
    CGFloat buniseeY = BUTTON_Y +CGRectGetMaxY(self.facName.frame);
    
    
    self.Business = [[UILabel alloc] initWithFrame:CGRectMake(buniseeX, buniseeY, buniseeW, buniseeH)];
    self.Business.text = @"主营业务";
    self.Business.backgroundColor = [UIColor  redColor];
    [self.scrollView  addSubview:self.Business];
    
    
    
    //facTectFiled
    
    CGFloat facTectFiledW = w;
    CGFloat facTectFiledH = SCALE_WIDTH(BUTTON_H -10);
    CGFloat facTectFiledX = CGRectGetMaxX(self.facName.frame)+MARGIN_1 * 2;
    CGFloat facTectFiledY = BUTTON_Y;
    self.facTexField = [[UITextField  alloc] initWithFrame:CGRectMake(facTectFiledX, facTectFiledY, facTectFiledW, facTectFiledH)];
    self.facTexField.placeholder = @"公司名称";
    [self.scrollView  addSubview:self.facTexField];
    
    //bunisessTextfiled
    
    CGFloat bunisessTextfiledW = w;
    CGFloat bunisessTextfiledH = SCALE_WIDTH(BUTTON_H -10);
    CGFloat bunisessTextfiledX = CGRectGetMaxX(self.Business.frame)+MARGIN_1 * 2;
    CGFloat bunisessTextfiledY =  BUTTON_Y +CGRectGetMaxY(self.facTexField.frame);
    self.BusinessTextField = [[UITextField  alloc] initWithFrame:CGRectMake(bunisessTextfiledX , bunisessTextfiledY, bunisessTextfiledW, bunisessTextfiledH)];
    self.BusinessTextField.placeholder = @"主营业务内容";
    [self.scrollView  addSubview:self.BusinessTextField];
 
    
    
    
    
//image 3
    CGFloat imageW = (SCREEN_WIDTH  -(MARGIN_2 * 2) - (MARGIN_1 * 2))/3;

    
    self.image1 =[[UIImageView  alloc] initWithImage:[UIImage imageNamed:@"mei.jpg"]];
    self.image1.frame =CGRectMake(MARGIN_2,CGRectGetMaxY(self.BusinessTextField.frame)+MARGIN_1 , imageW, SCALE_WIDTH(BUTTON_H + 30));
    [self.scrollView  addSubview:self.image1];

    

    
    self.image2 =[[UIImageView  alloc] initWithImage:[UIImage imageNamed:@"mei.jpg"]];
    self.image2.frame =CGRectMake(MARGIN_2 + CGRectGetMaxX(self.image1.frame),CGRectGetMaxY(self.BusinessTextField.frame)+MARGIN_1 , imageW, SCALE_WIDTH(BUTTON_H + 30));
    [self.scrollView  addSubview:self.image2];


    self.image3 =[[UIImageView  alloc] initWithImage:[UIImage imageNamed:@"mei.jpg"]];
    self.image3.frame =CGRectMake(MARGIN_2 + CGRectGetMaxX(self.image2.frame),CGRectGetMaxY(self.BusinessTextField.frame)+MARGIN_1 , imageW, SCALE_WIDTH(BUTTON_H + 30));
    [self.scrollView  addSubview:self.image3];
    

  
    
    //facBig
    self.facBag = [[UILabel  alloc] initWithFrame:CGRectMake(MARGIN_2 , CGRectGetMaxY(self.image3.frame) +6, SCREEN_WIDTH - 20, SCALE_WIDTH(200))];
    self.facBag.text  = @"hdef fhdjfhdjhfkdfkdjfkdfj在cellForRowAtIndexPath中使用dequeueReuseableCellWithIdentifier:forIndexPath:获取重用的cell，若无重用的cell，将自动使用所提供的n）";
    self.facBag.layer.borderWidth = 1;
    self.facBag.layer.borderColor = [UIColor grayColor].CGColor;
    self.facBag.layer.cornerRadius = 3;
    self.facBag.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.facBag];



    
    //facBig
    self.facSmall = [[UILabel  alloc] initWithFrame:CGRectMake(MARGIN_2 , CGRectGetMinX(self.facBag.frame) +6, SCALE_WIDTH(80), SCALE_WIDTH(30))];
    self.facSmall.text  = @"公司简介";
    self.facSmall.layer.borderWidth = 1;
    self.facSmall.layer.borderColor = [UIColor grayColor].CGColor;
    self.facSmall.layer.cornerRadius = 3;
    self.facSmall.layer.masksToBounds = YES;
    [self.facBag  addSubview:self.facSmall];
    

    
    //adress  web  number lable
    
    self.adressLabel = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_2, CGRectGetMaxY(self.facBag.frame) + 10, SCALE_WIDTH(80), SCALE_WIDTH(30))];
    self.adressLabel.text  = @"经营地址：";
    self.adressLabel.layer.borderWidth = 1;
    self.adressLabel.layer.borderColor = [UIColor grayColor].CGColor;
    self.adressLabel.layer.cornerRadius = 3;
    self.adressLabel.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.adressLabel];
    
    self.webLable = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_2, CGRectGetMaxY(self.adressLabel.frame) + 10, SCALE_WIDTH(80), SCALE_WIDTH(30))];
    self.webLable.text  = @"官方地址：";
    self.webLable.layer.borderWidth = 1;
    self.webLable.layer.borderColor = [UIColor grayColor].CGColor;
    self.webLable.layer.cornerRadius = 3;
    self.webLable.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.webLable];
    
    

    
    self.nuberlable = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_2, CGRectGetMaxY(self.webLable.frame) + 10, SCALE_WIDTH(80), SCALE_WIDTH(30))];
    self.nuberlable.text  = @"官方电话：";
    self.nuberlable.layer.borderWidth = 1;
    self.nuberlable.layer.borderColor = [UIColor grayColor].CGColor;
    self.nuberlable.layer.cornerRadius = 3;
    self.nuberlable.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.nuberlable];
    
    
    
    
    
   self.adressLabelMain = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_2 + CGRectGetMaxX(self.adressLabel.frame), CGRectGetMaxY(self.facBag.frame) + 10, SCALE_WIDTH(180), SCALE_WIDTH(30))];
    self.adressLabelMain.text  = @"官方电话：";
    self.adressLabelMain.layer.borderWidth = 1;
    self.adressLabelMain.layer.borderColor = [UIColor grayColor].CGColor;
    self.adressLabelMain.layer.cornerRadius = 3;
    self.adressLabelMain.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.adressLabelMain];
    
    
    self.webLableMain = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_2 +CGRectGetMaxX(self.webLable.frame) , CGRectGetMaxY(self.adressLabelMain.frame) + 10, SCALE_WIDTH(180), SCALE_WIDTH(30))];
    self.webLableMain.text  = @"官方电话：";
    self.webLableMain.layer.borderWidth = 1;
    self.webLableMain.layer.borderColor = [UIColor grayColor].CGColor;
    self.webLableMain.layer.cornerRadius = 3;
    self.webLableMain.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.webLableMain];
    

    self.nuberlableMain = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_2 +CGRectGetMaxX(self.nuberlable.frame) , CGRectGetMaxY(self.webLableMain.frame) + 10, SCALE_WIDTH(180), SCALE_WIDTH(30))];
    self.nuberlableMain.text  = @"官方电话：";
    self.nuberlableMain.layer.borderWidth = 1;
    self.nuberlableMain.layer.borderColor = [UIColor grayColor].CGColor;
    self.nuberlableMain.layer.cornerRadius = 3;
    self.nuberlableMain.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.nuberlableMain];
    
//button
   
    
    
    
    self.mapButton = [[UIButton alloc] initWithFrame:CGRectMake(MARGIN_2 + CGRectGetMaxX(self.adressLabelMain.frame), CGRectGetMaxY(self.facBag.frame) + 10, SCALE_WIDTH(90), SCALE_WIDTH(30))];
    self.mapButton.backgroundColor = [UIColor yellowColor];
    [self.scrollView  addSubview:self.mapButton];
    
    self.webButton = [[UIButton alloc] initWithFrame:CGRectMake(MARGIN_2 + CGRectGetMaxX(self.webLableMain.frame), CGRectGetMaxY(self.mapButton.frame) + 10, SCALE_WIDTH(90), SCALE_WIDTH(30))];
    self.webButton.backgroundColor = [UIColor yellowColor];
    [self.scrollView  addSubview:self.webButton];
    
    
    
    self.CallButton = [[UIButton alloc] initWithFrame:CGRectMake(MARGIN_2 + CGRectGetMaxX(self.nuberlableMain.frame), CGRectGetMaxY(self.webButton.frame) + 10, SCALE_WIDTH(90), SCALE_WIDTH(30))];
    self.CallButton.backgroundColor = [UIColor yellowColor];
    [self.scrollView  addSubview:self.CallButton];
    

    //lable
    
    self.productLable = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_2  , CGRectGetMaxY(self.CallButton.frame) + 10, SCALE_WIDTH(150), SCALE_WIDTH(30))];
    self.productLable.text  = @"官方电话：";
    self.productLable.layer.borderWidth = 1;
    self.productLable.layer.borderColor = [UIColor grayColor].CGColor;
    self.productLable.layer.cornerRadius = 3;
    self.productLable.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.productLable];
    
    
    
    self.zixunLabe = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.productLable.frame)+30 , CGRectGetMaxY(self.CallButton.frame) + 10,SCALE_WIDTH(150) , SCALE_WIDTH(30))];
    self.zixunLabe.text  = @"官方电话：";
    self.zixunLabe.layer.borderWidth = 1;
    self.zixunLabe.layer.borderColor = [UIColor grayColor].CGColor;
    self.zixunLabe.layer.cornerRadius = 3;
    self.zixunLabe.layer.masksToBounds = YES;
    [self.scrollView  addSubview:self.zixunLabe];
    
    
    
}




















- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
